package com.gzc.protobug;

import com.google.protobuf.InvalidProtocolBufferException;

public class ProtoBufTest {

    public static void main(String[] args) throws InvalidProtocolBufferException {
        DataInfo.Student zs = DataInfo.Student.newBuilder().setName("中山").setAddress("33").setId(1).build();

        byte[] bytes = zs.toByteArray();

        DataInfo.Student student = DataInfo.Student.parseFrom(bytes);

        System.out.println(student.getName());
    }
}

